<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/keySwitching.h File Reference</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">keySwitching.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><ul>
<li>Declaration of key switching matrices </li>
</ul>
 
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;climits&gt;</code><br />
<code>#include &lt;<a class="el" href="_double_c_r_t_8h_source.html">helib/DoubleCRT.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="_context_8h_source.html">helib/Context.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="_ctxt_8h_source.html">helib/Ctxt.h</a>&gt;</code><br />
</div>
<p><a href="key_switching_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_key_switch.html">helib::KeySwitch</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Key-switching matrices.  <a href="classhelib_1_1_key_switch.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacehelib"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html">helib</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae5b3ba4659fee95212891f530d1a88c1"><td class="memItemLeft" align="right" valign="top">std::ostream &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#ae5b3ba4659fee95212891f530d1a88c1">helib::operator&lt;&lt;</a> (std::ostream &amp;str, const KeySwitch &amp;matrix)</td></tr>
<tr class="separator:ae5b3ba4659fee95212891f530d1a88c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
Strategies for generating key-switching matrices</h2></td></tr>
<tr><td class="ititle" colspan="2"><p><a class="anchor" id="amgrp7d2878e27d1f99949dac6474bd0f3c5d"></a>These functions are implemented in KeySwitching.cpp </p>
</td></tr>
<tr class="memitem:a3838902c58164cdb58bee2043b2263bd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">HELIB_KEYSWITCH_THRESH</a>&#160;&#160;&#160;(50)</td></tr>
<tr class="memdesc:a3838902c58164cdb58bee2043b2263bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constant defining threshold above which a baby-set/giant-step strategy is used.  <a href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">More...</a><br /></td></tr>
<tr class="separator:a3838902c58164cdb58bee2043b2263bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad5770a5b60a665868babc5126ae07944"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="key_switching_8h.html#ad5770a5b60a665868babc5126ae07944">HELIB_KEYSWITCH_MIN_THRESH</a>&#160;&#160;&#160;(8)</td></tr>
<tr class="memdesc:ad5770a5b60a665868babc5126ae07944"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constant defining threshold above which a single giant step matrix is added even in HELIB_KSS_MIN mode. This helps in the matmul routines.  <a href="key_switching_8h.html#ad5770a5b60a665868babc5126ae07944">More...</a><br /></td></tr>
<tr class="separator:ad5770a5b60a665868babc5126ae07944"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4fb58a793bef4befd9d75d8852d8fc55"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a4fb58a793bef4befd9d75d8852d8fc55">helib::KSGiantStepSize</a> (long D)</td></tr>
<tr class="memdesc:a4fb58a793bef4befd9d75d8852d8fc55"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function that returns number of baby steps. Used to keep this and matmul routines "in sync".  <a href="namespacehelib.html#a4fb58a793bef4befd9d75d8852d8fc55">More...</a><br /></td></tr>
<tr class="separator:a4fb58a793bef4befd9d75d8852d8fc55"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4da7a89f85244e58f456a86832c46a27"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a4da7a89f85244e58f456a86832c46a27">helib::addAllMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="memdesc:a4da7a89f85244e58f456a86832c46a27"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maximalistic approach: generate matrices s(X^e)-&gt;s(X) for all e in Zm*.  <a href="namespacehelib.html#a4da7a89f85244e58f456a86832c46a27">More...</a><br /></td></tr>
<tr class="separator:a4da7a89f85244e58f456a86832c46a27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd7803e7000d31eda4aa3af44bfe0ef0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#acd7803e7000d31eda4aa3af44bfe0ef0">helib::addFewMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="memdesc:acd7803e7000d31eda4aa3af44bfe0ef0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate matrices so every s(X^e) can be reLinearized in at most two steps.  <a href="namespacehelib.html#acd7803e7000d31eda4aa3af44bfe0ef0">More...</a><br /></td></tr>
<tr class="separator:acd7803e7000d31eda4aa3af44bfe0ef0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ace8477657e91faeb4c33824bab098d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a3ace8477657e91faeb4c33824bab098d">helib::addSome1DMatrices</a> (SecKey &amp;sKey, long bound=<a class="el" href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">HELIB_KEYSWITCH_THRESH</a>, long keyID=0)</td></tr>
<tr class="memdesc:a3ace8477657e91faeb4c33824bab098d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate some matrices of the form s(X^{g^i})-&gt;s(X), but not all. For a generator g whose order is larger than bound, generate only enough matrices for the giant-step/baby-step procedures (2*sqrt(ord(g))of them).  <a href="namespacehelib.html#a3ace8477657e91faeb4c33824bab098d">More...</a><br /></td></tr>
<tr class="separator:a3ace8477657e91faeb4c33824bab098d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8f3689b135fde2c843eed5ce0813a975"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a8f3689b135fde2c843eed5ce0813a975">helib::add1DMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="memdesc:a8f3689b135fde2c843eed5ce0813a975"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate all matrices s(X^{g^i})-&gt;s(X) for generators g of Zm* /(p) and i&lt;ord(g). If g has different orders in Zm* and Zm* /(p) then generate also matrices of the form s(X^{g^{-i}})-&gt;s(X)  <a href="namespacehelib.html#a8f3689b135fde2c843eed5ce0813a975">More...</a><br /></td></tr>
<tr class="separator:a8f3689b135fde2c843eed5ce0813a975"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63d75eed1d12814e2e858ab82e07d311"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a63d75eed1d12814e2e858ab82e07d311">helib::addBSGS1DMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="separator:a63d75eed1d12814e2e858ab82e07d311"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a40b42a155c81c0507222ebca1f0a39f8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a40b42a155c81c0507222ebca1f0a39f8">helib::addSomeFrbMatrices</a> (SecKey &amp;sKey, long bound=<a class="el" href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">HELIB_KEYSWITCH_THRESH</a>, long keyID=0)</td></tr>
<tr class="memdesc:a40b42a155c81c0507222ebca1f0a39f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate all/some Frobenius matrices of the form s(X^{p^i})-&gt;s(X)  <a href="namespacehelib.html#a40b42a155c81c0507222ebca1f0a39f8">More...</a><br /></td></tr>
<tr class="separator:a40b42a155c81c0507222ebca1f0a39f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a62bfda232309a69cc3824e5323345073"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a62bfda232309a69cc3824e5323345073">helib::addFrbMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="separator:a62bfda232309a69cc3824e5323345073"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9483c8e129d827f9b49f140a327dd15"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#af9483c8e129d827f9b49f140a327dd15">helib::addBSGSFrbMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="separator:af9483c8e129d827f9b49f140a327dd15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c3d6b66cd30aed055d9c5a6333eca7c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a0c3d6b66cd30aed055d9c5a6333eca7c">helib::addMinimal1DMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="memdesc:a0c3d6b66cd30aed055d9c5a6333eca7c"><td class="mdescLeft">&#160;</td><td class="mdescRight">These routines just add a single matrix (or two, for bad dimensions)  <a href="namespacehelib.html#a0c3d6b66cd30aed055d9c5a6333eca7c">More...</a><br /></td></tr>
<tr class="separator:a0c3d6b66cd30aed055d9c5a6333eca7c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa94886e3afbcd49800243fd7fdaedd39"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#aa94886e3afbcd49800243fd7fdaedd39">helib::addMinimalFrbMatrices</a> (SecKey &amp;sKey, long keyID=0)</td></tr>
<tr class="separator:aa94886e3afbcd49800243fd7fdaedd39"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d420cdf0dc5b6968a8a89809cd5b5f3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a7d420cdf0dc5b6968a8a89809cd5b5f3">helib::addMatrices4Network</a> (SecKey &amp;sKey, const PermNetwork &amp;net, long keyID=0)</td></tr>
<tr class="separator:a7d420cdf0dc5b6968a8a89809cd5b5f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96c1092ac50c752cc8577da03cf232d4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a96c1092ac50c752cc8577da03cf232d4">helib::addTheseMatrices</a> (SecKey &amp;sKey, const std::set&lt; long &gt; &amp;automVals, long keyID=0)</td></tr>
<tr class="memdesc:a96c1092ac50c752cc8577da03cf232d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate specific key-switching matrices, described by the given set.  <a href="namespacehelib.html#a96c1092ac50c752cc8577da03cf232d4">More...</a><br /></td></tr>
<tr class="separator:a96c1092ac50c752cc8577da03cf232d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><ul>
<li>Declaration of key switching matrices </li>
</ul>
<ul>
<li>Other key switching-related free functions</li>
</ul>
<p>Copyright IBM Corporation 2019 All rights reserved. </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ad5770a5b60a665868babc5126ae07944"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad5770a5b60a665868babc5126ae07944">&#9670;&nbsp;</a></span>HELIB_KEYSWITCH_MIN_THRESH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define HELIB_KEYSWITCH_MIN_THRESH&#160;&#160;&#160;(8)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constant defining threshold above which a single giant step matrix is added even in HELIB_KSS_MIN mode. This helps in the matmul routines. </p>

</div>
</div>
<a id="a3838902c58164cdb58bee2043b2263bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3838902c58164cdb58bee2043b2263bd">&#9670;&nbsp;</a></span>HELIB_KEYSWITCH_THRESH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define HELIB_KEYSWITCH_THRESH&#160;&#160;&#160;(50)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constant defining threshold above which a baby-set/giant-step strategy is used. </p>

</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
